﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UI
{
    public partial class Frm_ExitDialog : Form
    {
        private Button Yes = new Button();
        private Button No = new Button();
        private Button Cancel = new Button();
        private Label Message = new Label();


        public Frm_ExitDialog()
        {
            InitializeComponent();
            this.DialogResult = DialogResult.Cancel;
            this.BackColor = System.Drawing.Color.LightBlue;
            this.AcceptButton = Yes;
            this.CancelButton = Cancel;

            //
            // Gen Messsage
            Message.Name = "Message";
            Message.Parent = this;
            Message.Font = new Font("Comic Sans MS", 15);
            Message.TextAlign = ContentAlignment.MiddleCenter;
            Message.Text = "Vuoi cominciare una nuova partita?";
            Message.Top = 10;
            Message.Left = 10;
            Message.Width = this.Width - 20;
            Message.Height = (this.Height / 2) - 20;

            //
            // Gen Yes
            Yes.Name = "Yes";
            Yes.Parent = this;
            Yes.Font = new Font("Comic Sans MS", 12);
            Yes.TextAlign = ContentAlignment.MiddleCenter;
            Yes.Text = "Si";
            Yes.Click += new EventHandler(yes_click);
            Yes.AutoSize = true;
            Yes.Top = (this.Height / 2) + (this.Height / 2 - Yes.Height) / 2;
            Yes.Left = (this.Width / 3 - Yes.Width) / 2;
            Yes.TabIndex = 1;
            Yes.BackColor = System.Drawing.Color.LightGreen;

            //
            // Gen No
            No.Name = "No";
            No.Parent = this;
            No.Font = new Font("Comic Sans MS", 12);
            No.TextAlign = ContentAlignment.MiddleCenter;
            No.Text = "No";
            No.Click += new EventHandler(no_click);
            No.AutoSize = true;
            No.Top = (this.Height / 2) + (this.Height / 2 - No.Height) / 2;
            No.Left = this.Width / 3 + (this.Width / 3 - No.Width) / 2;
            No.TabIndex = 0;
            No.BackColor = System.Drawing.Color.LightSalmon;

            //
            // Gen Cancel
            Cancel.Name = "Cancel";
            Cancel.Parent = this;
            Cancel.Font = new Font("Comic Sans MS", 12);
            Cancel.TextAlign = ContentAlignment.MiddleCenter;
            Cancel.Text = "Cancella";
            Cancel.Click += new EventHandler(cancel_click);
            Cancel.AutoSize = true;
            Cancel.Top = (this.Height / 2) + (this.Height / 2 - Cancel.Height) / 2;
            Cancel.Left = this.Width / 3 * 2 + (this.Width / 3 - Cancel.Width) / 2;
            Cancel.TabIndex = 2;
            Cancel.BackColor = System.Drawing.Color.White;

        }

        public void yes_click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Yes;
            this.Close();
        }

        public void no_click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.No;
            this.Close();
        }

        public void cancel_click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            this.Close();
        }

    }
}
